package com.dm.controller;

import com.dm.service.AlipayService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;

@RestController
@RequestMapping("/pay")
public class AlipayController {
    @Resource
    private AlipayService alipayService;

    @RequestMapping(value = "/getPay",method = RequestMethod.GET)
    public void getPay(@RequestParam String orderId, @RequestParam String price,@RequestParam String itemName, HttpServletResponse response)throws Exception{
        response.setContentType("text/html;charSet=utf-8");
        String ret=alipayService.getPay(orderId,price,itemName);
        response.getWriter().println(ret);
        response.getWriter().flush();
        response.getWriter().close();
    }
}
